﻿Public Class RegexMatchViewModel
    Inherits RegexViewModelBase
    Implements IEnumerable(Of IEnumerable)

#Region "Events"
    ' Insert Event Declarations Here
#End Region

#Region "Properties"
#Region "Constants"
    ' Insert Constant Declarations Here
#End Region

    Private _enumerator As IEnumerator(Of IEnumerable)

    Private _match As Match
    Public Property Match As Match
        Get
            Return _match
        End Get
        Private Set(value As Match)
            _match = value
        End Set
    End Property

    Public Overrides ReadOnly Property Index As Integer
        Get
            Return Me.Match.Index
        End Get
    End Property

    Public Overrides ReadOnly Property Length As Integer
        Get
            Return Me.Match.Length
        End Get
    End Property
#End Region

#Region "Constructors"
    Public Sub New(match As Match, regex As Regex, viewNavigator As IViewNavigator)
        MyBase.New(regex, viewNavigator)
        Me.Match = match
        _enumerator =
            New IEnumerable() {
                New RegexCapturesViewModel(Me.Match.Captures, regex, viewNavigator),
                New RegexGroupsViewModel(Me.Match.Groups, regex, viewNavigator)
            }.
            AsEnumerable().
            GetEnumerator()
    End Sub
#End Region

#Region "Methods"
    Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of System.Collections.IEnumerable) Implements System.Collections.Generic.IEnumerable(Of System.Collections.IEnumerable).GetEnumerator
        Return _enumerator
    End Function

    Private Function GetEnumerator1() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
        Return GetEnumerator()
    End Function

#Region "Event Raiser Methods"
    ' Insert Method Declarations which Raise an Event Here
#End Region

#Region "Event Handlers"
    ' Insert Method Declarations which Handle an Event Here
#End Region
#End Region

End Class
